package com.byght.bygsystem.mapper;

import com.byght.bygsystem.model.TransactionType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TransactionTypeMapper {
    @Select("SELECT * FROM TransactionTypes WHERE id = #{id}")
    TransactionType getTransactionTypeById(int id);

    @Select("SELECT * FROM TransactionTypes")
    List<TransactionType> getAllTransactionTypes();

    @Insert("INSERT INTO TransactionTypes(name, description, created_at, updated_at) VALUES(#{name}, #{description}, #{createdAt}, #{updatedAt})")
    void insertTransactionType(TransactionType transactionType);

    @Update("UPDATE TransactionTypes SET name=#{name}, description=#{description}, updated_at=#{updatedAt} WHERE id = #{id}")
    void updateTransactionType(TransactionType transactionType);

    @Delete("DELETE FROM TransactionTypes WHERE id = #{id}")
    void deleteTransactionType(int id);
}

